package org.springframework.context.support;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

/**
 * @className：AbstractRefreshableConfigApplicationContext
 * @description:
 * @author: xiaohuihui
 * @createDate: 2021/8/29
 * @version: 1.0
 */
public abstract class AbstractRefreshableConfigApplicationContext extends AbstractRefreshableApplicationContext
        implements BeanNameAware, InitializingBean {

    @Nullable
    private String[] configLocations;

    /**
     *使用给定的父上下文创建一个新的AbstractRefreshableConfigApplicationContext
     * @param parent
     */
    public AbstractRefreshableConfigApplicationContext(@Nullable ApplicationContext parent) {
        super(parent);
    }

    public void setConfigLocation(@Nullable String... location){
        if (location != null){
            Assert.noNullElements(location,"Config locations must not be null");
            this.configLocations = new String[location.length];
            for (int i = 0; i < location.length; i++) {
                this.configLocations[i] = resolvePath(location[i].trim());
            }
        }
    }



    protected String resolvePath(String path){
        return null;
    }
}
